package be.novelfaces.test.common;

import static org.jboss.test.faces.mock.FacesMockController.invokeCurrent;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorHolder;

import org.easymock.IMocksControl;
import org.jboss.test.faces.mock.component.MockUIInput;

@SuppressWarnings("unchecked")
public class MockClientBehaviorHolder extends MockUIInput implements ClientBehaviorHolder {

    public MockClientBehaviorHolder(IMocksControl control, String name) {
        super(control, name);
    }

    public void addClientBehavior(String eventName, ClientBehavior behavior) {
        invokeCurrent(this, eventName, behavior);
    }

    public Map<String, List<ClientBehavior>> getClientBehaviors() {
        return invokeCurrent(this);
    }

    public String getDefaultEventName() {
        return invokeCurrent(this);
    }

    public Collection<String> getEventNames() {
        return invokeCurrent(this);
    }
    
    public String toString() {
        return getClass().getSimpleName();
    }

}
